export let MixinsStyleClass = {
    methods: {
        getStyleObj() {
            var wInstance = _.get(this, 'widget', this.element);
            var style = _.get(wInstance, "options.style");
            if (style == "") {
                style = { style: "", classList: [] };
                _.set(wInstance, "options.style", style);
            }
            return style;
        },
        Style(value) {
            var style = this.getStyleObj();
            if (style && false === _.isNil(value)) {
                style.style = value;
            }
            return style.style;
        },
        CSSClass(classList) {
            var style = this.getStyleObj();
            if (style && style.classList && false === _.isUndefined(classList)) {
                style.classList = [...(classList || [])];
            }
            return style.classList;
        },
        AddClass(className) {
            var classList = this.RemoveClass(className);
            classList = this.CSSClass();
            classList.push(className);
            return classList;
        },
        RemoveClass(className) {
            var classList = this.CSSClass();
            _.remove(classList, (item) => item == className);
            var style = this.getStyleObj();
            style.classList = [...classList];
            return style.classList;
        },
        ToggleClass(className) {
            var classList = this.CSSClass();
            var findIndex = _.includes(classList, className);
            if (findIndex) {
                classList = this.RemoveClass(className);
            } else {
                classList = this.AddClass(className);
            }
            return classList;
        },
    }
}